<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>IupSetCallback</title>

<link rel="stylesheet" type="text/css" href="../../style.css">
<style type="text/css">
.style1 {
	text-decoration: underline;
}
</style>
</head>
<body>

<h2>IupSetCallback</h2>
<p>Associates a callback to an event.</p>
<h3>
Parameters/Return</h3>
<pre>Icallback IupSetCallback(Ihandle* <b>ih</b>, const char *<strong>name</strong>, Icallback <strong>func</strong>); [in C]
[There is no equivalent in Lua]</pre>
<p><b>ih</b>: identifier of the interface element. <strong><br>
</strong><b>name</b>: 
  attribute name of the callback.<br>
<b>func</b>: address of a C function. If NULL removes the association.</p>
<p><span class="style1">Returns:</span> the address of the previous function 
  associated to the action.</p>
<h3>Notes</h3>
<p>This function replaces the combination:</p>
<pre>IupSetFunction(global_name, func);
IupSetAttribute(ih, name, global_name);</pre>
<p>So it eliminates the need for a global name. </p>
<p>Callbacks set using <b>IupSetCallback</b> can not be retrieved using
  <b>IupGetFunction</b>. </p>
<p>In Lua, callbacks are associated by simply setting a function as the value of 
the callback name, for example:</p>
<pre>button = iup.button{...

button.action = function(...    OR
function button:action(...</pre>
<h3>See Also</h3>
<p><a href="iupgetcallback.html">IupGetCallback</a>, 
<a href="iupsetfunction.html">IupSetFunction</a></p>

</body>

</html>
